Method of controlling DRAM for managing flash memory

ABSTRACT

A method of writing data to a flash memory for efficiently managing the flash memory is provided. According to the method of the present invention, a page or a block can be selected as a unit for writing data to the flash memory. When a host, for instance, computer, card reader, cellular phone and alike, process the step of writing data into the flash memory, the volume of data is calculated for determining the time and frequency of moving and erasing data for both page and block as a unit. Based on the above result, the most appropriate method of writing data is selected to substantially improve speed of the writing process and also to reduce the frequency of erasing steps in order to extend the service life of the flash memory.

BACKGROUND OF THE INVENTION

1.The Field of the Invention

The present invention relates to a method of controlling a DRAM, andmore particularly relates to a method of controlling a DRAM forselecting a page or a block as a unit to process the steps of retrievingor saving data to the flash memory.

2. Description of Related Art

In the conventional method of reading data from any address in a page,due to the physical characteristics of the conventional flash memory, apage is usually taken as a reading unit. For writing data, the flashmemory takes a block as a unit and erases the whole block and thenwrites data into pages in a order of page by page. Thus if the volume ofthe data is smaller than a block, then data processing is accordinglylimited due to the structure limits.

For writing data into a page of the flash memory completely, thephysical characteristics of the flash memory requires a page should beabsolutely blank or have no data therein and the volume of the datashould be equal to a sector. Therefore, the page should be verified thatit is completely blank or has no data therein before writing data intopage. The term “blank” here means, the data in every pages of the blockare “1”. According to the conventional writing method a block is takenas a unit, and therefore to write data into one page of the block, theflash memory has to find an absolutely blank block, namely, a backupblock, and then the data is written into the blank page of the newblock. So the data in the old block is completely moved into the newblock and then, the old block is erased. The old block after beingcompletely erased serves as a new block.

When the volume of the data is equivalent to a few continuous blocks,the flash memory finds a new block for writing the data into the pagethereof; then to move the data into the page of the new block, and afterwriting of the data is completed, the old block is erased. Because in ahost, for instance, a computer, a card reader, a cellular phone and thelike, the file arrangement table (FAT) of the flash memory is oftenrevolutionary, and if the data is usually for small files, the flashmemory has to work repeatedly according to the rule of first finding anew block, moving data into the new block and then erasing the oldblock.

Frequent erasing steps would easily damage the internal structure of theflash memory. It is found that after one million times of erasing steps,the flash memory easily gets damaged. Therefore, by reducing thefrequency of erasing steps, the service life of the flash memory can beextended. Accordingly, for writing data, if a block is taken as a unit,the erasing frequency cannot be reduced and therefore the service lifeof the flash memory is limited.

SUMMARY OF THE INVENTION

Accordingly, in the view of the foregoing, the present inventor makes adetailed study of related art to evaluate and consider, and uses yearsof accumulated experience in this field, and through severalexperiments, to create a method for reducing the frequency of erasingsteps of the flash memory. The present invention provides an innovatedcost effective a method for reducing the frequency of erasing steps ofthe flash memory so that the service life of the flash memory can besubstantially promoted.

According to an aspect of the present invention, for writing data, apage or a block can be selected as a unit for efficiently managing theflash memory. When a host, for instance, computer, card reader, cellularphone and alike, process the step of writing data into the flash memory,the volume of data is calculated for determining the time and frequencyof moving and erasing data for both page and block as a unit. Based onthe above result, the most appropriate method of writing data isselected to substantially improve the speed of the writing process andalso to reduce the frequency of erasing steps in order to extend theservice life of the flash memory.

BRIEF DESCRIPTION OF THE DRAWING

For a more complete understanding of the present invention, referencewill now be made to the following detailed description of preferredembodiments taken in conjunction with the following accompanyingdrawings.

FIG. 1 is a block diagram of a system including a flash memory accordingto a preferred embodiment of the present invention.

FIG. 2 is a block diagram of a flash memory using a page as a unitaccording to a preferred embodiment of the present invention.

FIG. 3 is a timing chart for processing erasing step according to apreferred embodiment of the present invention.

FIG. 4 is a timing chart for processing writing step using a page as aunit according to a preferred embodiment of the present invention.

FIG. 5 is a block diagram illustrating an erasing step of a pageaccording to preferred embodiment of the present invention.

FIG. 6 is a block diagram showing a writing data using a page as a unitaccording to a preferred embodiment of the present invention.

FIG. 7 is a block diagram (I) illustrating a writing data using a blockas a unit according to a preferred embodiment of the present invention.

FIG. 8 is a block diagram (II) illustrating a writing data using a blockas a unit according to a preferred embodiment of the present invention.

FIG. 9 is a block diagram (III) illustrating a writing data using ablock as a unit according to a preferred embodiment of the presentinvention.

FIG. 10 is a block diagram (IV) illustrating a writing data using ablock as a unit according to a preferred embodiment of the presentinvention.

FIG. 11 is a block diagram (V) illustrating a writing data using a blockas a unit according to a preferred embodiment of the present invention.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Reference will be made in detail to the preferred embodiments of theinvention, examples of which are illustrated in the accompanyingdrawings. Wherever possible, the same reference numbers are used in thedrawings and the description to refer to the same or like parts.

Referring to FIG. 1, a block diagram of a system including a flashmemory according to a preferred embodiment of the present invention isshown. The system comprises a single chip flash memory controller 11, aflash memory 12, a host interface 13 and a host 14. The single chipflash memory controller 11 is connected to the flash memory 12, andthrough the host interface 13 to connect to the host 14, for example, acomputer, a card reader, a cellular phone and the like, allowing thehost 14 to control the single chip flash memory controller 11 tosave/retrieve data to/from the flash memory 12. The single chip flashmemory controller 11 has a program memory 15 inlayed inside or attachedoutside enabling the single chip flash memory controller 11 to processsaving/retrieving to the flash memory 12 according to the preset programof the program memory 15.

Referring to FIG. 2, a block diagram of a flash memory using a page as aunit according to a preferred embodiment of the present invention isshown. The flash memory has to erase a block or a page every time beforewriting data therein. An erasing timing chart is shown in FIG. 3 inwhich a page is taken as a writing unit, and a writing timing chart isshown in FIG. 4 in which a page is taken as a writing unit.

In the present invention, referring to FIGS. 1, 5 and 6, the method ofwriting data allows the use of a new block (backup block) to move thenew data into pages according to the volume of data, or directly toerase the page 51 that needs to be amended in order to render the page51 blank (as shown in FIG. 5) and then fill the new data into page 51(as shown in FIG. 6). Accordingly, the frequency of erasing steps can bereduced to effectively extend the service life of the flash memory 12.

According to the specification, for example, the time for erasing a pageor a block is about 4 mini seconds (ms). The page program time is about200 micron seconds (μs). As there are 32 pages in a block, therefore,the block program time is 32 times of the page program time (200 μs×32),which is equal to 6.4 ms. The time for reading a page is about 5 μs plus50 ns multiplied by 528, which is equal to 31.4 μs. Therefore, becausethe conventional method of managing usually uses a block as a unit, torefresh a page within the block, unless the data in a new page is inputfrom an outer controller, the preset data in 31 pages has to be movedfrom the old block to the new block (as shown in FIGS. 7, 8, 9, 10 and11), and therefore the time required is at least the block erasing timemultiplied by 1 plus the time required for reading a page multiplied by31 and the resulting total time plus the page program time multiplied by32. Accordingly, the result is equal to 11.37 ms. However, when using apage as a unit for managing, as shown in FIGS. 5 and 6, the timerequired is only the a page erasing time plus a page program time, whichis equal to 4.2 ms, and thereby the time for moving 31 pages from theold block to the new block can be effectively skipped.

However, time for erasing a page or a block is same, namely, 4 ms, andtherefore, if the data in all 32 pages are different from the originalone and requires total erasure of the block, for writing data, thenecessary procedure is to only erase pages, the time required is thetotal erasing time for erasing 32 pages, which is equal to the timerequired for erasing a page multiplied by 32 plus the total page programtime for 32 pages, which is the page program time multiplied by 32, andaccordingly the total time is equal to 134.4 ms, which is significantlymore than the time for erasing an entire block, and on top of this, thetotal page program time of 32 pages has to be added, which is 10.4 ms.Therefore, it is wise to select a page as a unit or a block as a unitdepending on the page program time, page erasing time, page reading andblock erasing time in the specification of the flash memory 12.Accordingly, when the volume of the data to be processed is small, orequal to a page, it is advantageous to select a page as a unit. On theother hand, it is advantageous to select a block as a unit when thevolume of the data to be process is equivalent to multiple pages.Therefore, for writing data to flash memory, by selecting a page as aunit when the volume of the data is small, and selecting a block as aunit when the volume is equal to multiple pages, would be accordinglyadvantageous to substantially reduce the writing time. Further, thiswould also significantly reduce the frequency of erasing steps andtherefore the service life of the flash memory can be significantlyreduced.

The following description will now describe how a volume of a page to beprocessed is determined as being small or large in considering varioustime figures for calculating the most benefiting result.

First of all, say PR represents the page reading time, PP represents thepage program time, PE represents the page erase time and BE representsthe block erase time. Now to use a page erasing method to processseveral pages, say N number of pages, the time required for processingis PE*N+PP*N; and the time required for processing using the blockerasing method is BE*1+PR*(32−N)+PP*32. By comparing the above tworesults, the time which ever of the above is less entered as the dataprocessing selection parameter of the flash memory 12, for example, in aform of a equation expressed by PE*N+PP*N<BE*1+PR*(32−N)+PP*32, whereinPE=4 ms, PP=200 μs, PR=31.4 μs and BE=4 ms, resulting to N<2.6. Thus themost efficient data processing method of using page erasing can beselected benefiting shorter processing time and thereby reducing thefrequency of the erasing steps when N<2.6. The above result is based onthat the time for erasing a page or a block erase is same for the flashmemory 12, and accordingly, if a new specification for the flash memorypage erasing time in the future is lower than the block erasing time,the N value can be accordingly increased for selecting the best optionsfor managing the data processing of the flash memory according to theobjects of the present invention.

While the invention has been described in conjunction with a specificbest mode, it is to be understood that many alternatives, modifications,and variations will be apparent to those skilled in the art in light ofthe foregoing description. Accordingly, it is intended to embrace allsuch alternatives, modifications, and variations in which fall withinthe spirit and scope of the included claims. All matters set forthherein or shown in the accompanying drawings are to be interpreted in anillustrative and non-limiting sense.

1. A method of controlling a DRAM for saving/retrieving data to/from aflash memory, wherein the method of processing saving/retrieving a datato/from said flash memory comprising the steps of: (a) providing a host,wherein the host is connected to said DRAM, said host is programmed forcalculating a frequency and a time required for the steps of erasingdata, reading the data of the page(s), programming the page(s) andwriting the data to the page(s) using a page and a block as a unitrespectively according to a volume of said data; and (b) selectingeither a page as a unit or a block as a unit according to a result ofsaid step (a), for processing the step of saving/retrieving data to theflash memory.
 2. The method of controlling a DRAM for saving/retrievingdata to/from a flash memory according to claim 1, wherein forcalculating the frequency and time for the steps of erasing data,reading the data of the page(s), programming the page(s) and writing thedata to the page(s) using a page as a unit is expressed by the followingequation:TIME=PE*N+PP*N Wherein PR represents the time for reading the data ofthe page(s), PP represents the time for programming the page(s), PErepresents the time for erasing the page(s), and N represents the totalnumber of pages.
 3. The method of controlling a DRAM forsaving/retrieving data to/from a flash memory according to claim 1,wherein for calculating the frequency and time for the steps of erasingdata, reading the data of the page(s), programming the page(s) andwriting the data to the page(s) using a page as a unit is expressed bythe following equation:TIME=BE*1+PR*(32−N)+PP*32 Wherein PR represents the time for reading thedata of the page(s), PP represents the time for programming the page(s),PE represents the time for erasing the page(s), N represents the totalnumber of pages, and BE represents the time for erasing the block. 4.The method of controlling a DRAM for saving/retrieving data to/from aflash memory according to claim 1, wherein said host comprises acomputer, a card reader or a cellular phone.